<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f = "http://java.sun.com/jsf/core">
<body>
	<ui:composition>
		<f:event type="preRenderView" listener="#{employeeView.forwardToLoginIfNotLoggedIn}" /> 
		<h:graphicImage  library="img" name="fhj_logo.png" styleClass="logo" />
		<h1>Zeiterfassung</h1>
		<div class="login">
		<h:outputText value="#{employeeView.employee.firstName}" rendered="#{employeeView.loggedIn}"/>
		<br />
		<h:outputText value="#{employeeView.employee.employmentType}" rendered="#{employeeView.loggedIn}"/>		
		<h:form id="logoutForm" rendered="#{employeeView.loggedIn}">
			<h:outputText value="You are logged in! NICEEEE!!" rendered="#{employeeView.loggedIn}"/>
			<br />
			<h:commandButton action="#{employeeView.logout}" value="Logout" rendered="#{employeeView.loggedIn}" />
			
		</h:form>
		<h:outputText value="You are not logged in!" rendered="#{!employeeView.loggedIn}"/>
		<br />
		<h:link outcome="/login.xhtml" rendered="#{!employeeView.loggedIn}" value="Login" /> 
		</div>

	</ui:composition>
</body>
</html>


